
import pymysql

# 连接数据库
cnx = pymysql.connect(user='root', password='123456', host='localhost', database='guangfu')

# 创建游标对象
cursor = cnx.cursor()

# 定义创建表的SQL语句
create_table_query = '''
CREATE TABLE data_table (
    id INT AUTO_INCREMENT PRIMARY KEY,
    date_d varchar(128),
    one varchar(64) not null,
    two varchar(64) not null,
    three varchar(64) not null,
    four varchar(64) not null,
    wu varchar(64) not null,
    liu varchar(64) not null,
    qi varchar(64) not null,
    ba varchar(64) not null,
    jiu varchar(64) not null,
    shi varchar(64) not null,
    shiyi varchar(64) not null,
    shier varchar(64) not null,
    shisan varchar(64) not null,
    shisi varchar(64) not null,
    shiwu varchar(64) not null
)
'''

# 执行SQL语句
cursor.execute(create_table_query)

# 提交事务
cnx.commit()

# 关闭游标和数据库连接
cursor.close()
cnx.close()
